home *** CD-ROM | disk | FTP | other *** search
Wrap
/* The Field Machine -Quick v1.1 */ /* */ /* ©1993 Carmen Rizzolo */ Options Results Address 'OpalPaint_Rexx' Version Parse Var Result VerThingy ' ' OpalName ' ' VersionNum ' ' DateNum If Left(VersionNum,3) < 2.3 Then Do AskBool 'It appears that you are using OpalPaint v' || VersionNum || '\n\nField-Machine requires OpalPaint v2.3 or higher\n\nShall I continue?' If Result = 0 Then Do Okay 'Exiting...' Exit End End If Exists('LIBS:rexxsupport.library') = 0 Then Do Okay 'FATAL ERROR! You are missing the rexxsupport.library\nfrom your LIBS: directory. Check your Arexx\ninstallation.\n\nExiting...' Exit End Call ADDLIB('rexxsupport.library',0,-30,0) Iff = 0 Iff2 = 0 DeleteBool = 0 PALBool = 0 Main: Call CheckSparePages() Call CheckForSten() Menu DISABLE Call ConfirmFieldMachine() /* Turn off Brush Outlines */ Call NoOutlines() Call GetDefaultPath() Call GetAnimPath() Call WriteDefaultpath() Call MakeDestPath() Call GetFrameNumbers() Call GetFieldMode() Okay 'Here we go.' A = StartFrame Call GetTokens() Do Forever B = (A * 2) + 1 If A = EndFrame Then Leave Call GetIFF() Call LookForFieldA() Call LoadFieldA() Call Panic() Call AddSparePage() Call LookForFieldB() Call LoadFieldB() Call Panic() Call GoToFirstPage() /* SetUp Stencil for First Page */ Call Panic() Call LoadStencil() /* Enable RubThrough */ Call Rub() Call SaveImage() A = A + 1 End Address Command 'Delete Ram:FieldMachine.Brush Quiet' Address 'OpalPaint_Rexx' Okay 'Operation Complete' Exit CheckSparePages: Address 'OpalPaint_Rexx' PickPage 1 OpenPages NumPages = Result If NumPages ~= 1 Then Do Okay 'FATAL ERROR:\nThis script must not be run when OpalPaint has more than one page open.\nSave all your pages and delete them so I can start with one page.\n\nExiting...' Exit End Return CheckForSten: Address 'OpalPaint_Rexx' Finder = Exists('Images24:Stencils/FieldMachine.Sten') If Finder = 0 Then Do Okay 'FATAL ERROR: I cannot find the FieldMachine.Sten file in your\nImages24:Stencils directory. Please properly install\nthe Field Machine before running it!.' Okay 'Exiting...' Exit End Return ConfirmFieldMachine: Address 'OpalPaint_Rexx' ReqBuild '420 130 " "' AddBox '10 10 400 110' AddBox '15 15 5 5 Raised' AddBox '-20 15 5 5 Raised' AddBox '15 -20 5 5 Raised' AddBox '-20 -20 5 5 Raised' AddBox '47 -53 109 31' AddBox '-153 -53 106 31' AddHeading 'CenterX 20 "Field Machine - Quick v1.1"' AddHeading 'CenterX 35 "an Arexx script for OpalPaint v2.3 or higher"' AddHeading 'CenterX 45 "by Carmen Rizzolo"' AddGadget 'Button NTSCButton 50 -25 Small "NTSC"' AddGadget 'Button PALButton 103 -25 Small "PAL"' AddGadget 'Button NoButton -50 -25 Medium "Quit"' Request NoOK NoCancel GadgetStatus NTSCButton If Result = 1 Then PALBool = 0 GadgetStatus PALButton If Result = 1 Then PALBool = 1 GadgetStatus NoButton If Result = 1 Then Do Exit End Return PALBool NoOutlines: Address 'OpalPaint_Rexx' GetPrefs Prefs = Result If (Prefs//2048)<1024 Then Do NewPrefs=Prefs+1024 SetPrefs NewPrefs End Return GetDefaultPath: Address 'OpalPaint_Rexx' If Open('DefaultFile','OpalPaint:Rexx/FieldMachineDefault.TXT','r') = 1 Then Do AnimPathDefault = ReadLn('DefaultFile') Chucky = Close('DefaultFile') End Else Do AnimPathDefault = 'Imagine:FieldAnim.imp/a.pix/' End Return AnimPathDefault GetAnimPath: Address 'OpalPaint_Rexx' PathWarn = 1 Do Forever LeaveBool = 1 ReqBuild '450 161 "Choose animation pathname"' AddBox '10 23 430 105' AddText 'CenterX 29 "NOTE: Pathnames must end with a / character"' AddText 'CenterX 50 "Pathname"' AddGadget 'String ReqAnimPathName CenterX 60 Large' AddGadget 'Button SourceReq 25 60 80 20 " "' AddBox '22 57 86 26' AddHeading '29 67 "REQUESTOR"' AddGadget 'Button OKButton CenterX -5 Medium "Proceed"' InitGadget 'ReqAnimPathName ' || AnimPathDefault Request NoOK NoCancel GadgetStatus ReqAnimPathName AnimPathName = Result GadgetStatus SourceReq If Result = 1 Then Do If PathWarn = 1 Then Do ReqBuild '369 76 " "' AddBox '5 5 358 65' AddText 'CenterX 10 "NOTE: You are about to use a file requestor"' AddText 'CenterX 20 "to choose a PATHNAME. Do not select any"' AddText 'CenterX 30 "filenames. Get the pathname only!"' AddGadget 'Button Okeedoke CenterX 40 Medium "Proceed"' Request NoOK NoCancel PathWarn = 0 End AskFileName 'Get SOURCE animation PATHNAME' "OpalPaint:" '' AnimPathName = Result End If Right(AnimPathName,1) ~= '/' Then AnimPathName = AnimPathName || '/' AnimPathDefault = AnimPathName Finder = Exists(AnimPathName) If Finder = 1 Then Leave If Finder = 0 Then Okay 'ERROR: Drawer not found! Try agian...' End Return AnimPathName WriteDefaultPath: Address 'OpalPaint_Rexx' Call Open('DefaultWrite','OpalPaint:Rexx/FieldMachineDefault.TXT','w') Call WriteLn('DefaultWrite',AnimPathName) Call Close('DefaultWrite') Return MakeDestPath: Address 'OpalPaint_Rexx' Finder = Exists(AnimPathName || 'Field/') If Finder = 0 Then Do Address Command 'MakeDir ' || AnimPathName || 'Field' Address 'OpalPaint_Rexx' End Return GetFrameNumbers: Address 'OpalPaint_Rexx' LeaveBool = 1 StartDefault = 1 EndDefault = 2 Do Forever ReqBuild '320 160 "Frame numbers"' AddBox '5 25 309 102' AddText 'CenterX 35 "Enter First Frame number as"' AddText 'CenterX 45 "a normal ODD number."' AddGadget 'Integer StartGad CenterX 55 35 16' AddText 'CenterX 80 "Enter Last Frame number as"' AddText 'CenterX 90 "a normal EVEN number."' AddGadget 'Integer EndGad CenterX 100 35 16' AddGadget 'Button OkayGad CenterX -5 Medium "Proceed"' InitGadget 'StartGad ' || StartDefault InitGadget 'EndGad ' || EndDefault Request NoOK NoCancel GadgetStatus StartGad StartFrame = Result GadgetStatus EndGad EndFrame = Result /* Convert Starting Frame number to */ /* an odd number if need be */ If StartFrame/2 = StartFrame%2 Then Do StartFrame = StartFrame + 1 ReqBuild '320 135 "Warning!"' AddBox 5 25 309 77 AddText 'CenterX 35 "Starting frame MUST be an odd number!"' AddGadget 'Check YesGad 20 49 Medium' AddText 'Right YesGad 5 6 "Oops, I meant ' || StartFrame || '."' AddGadget 'Check NoGad Below YesGad 0 1 Medium' AddText 'Right NoGad 5 6 "Try Again"' AddGadget 'Button ProceedGad CenterX -5 Medium "Proceed"' InitGadget 'YesGad 1' MutualEx 'YesGad NoGad' Request NoOK NoCancel GadgetStatus NoGad If Result = 1 Then LeaveBool = 0 End /* Check to make sure Ending Number is */ /* higher than Starting Number */ If EndFrame <= StartFrame Then Do Okay 'FATAL ERROR! Ending number must be higher than the starting number.\nConsult the documentation! Exiting...' Exit End /* Check to see if Ending number is an */ /* even number */ If EndFrame/2 ~= EndFrame%2 Then Do EndFrame = EndFrame + 1 ReqBuild '320 135 "Warning!"' AddBox 5 25 309 77 AddText 'CenterX 35 "Ending frame MUST be an even number!"' AddGadget 'Check YesGad 20 49 Medium' AddText 'Right YesGad 5 6 "Oops, I meant ' || EndFrame || '."' AddGadget 'Check NoGad Below YesGad 0 1 Medium' AddText 'Right NoGad 5 6 "Try Again"' AddGadget 'Button ProceedGad CenterX -5 Medium "Proceed"' InitGadget 'YesGad 1' MutualEx 'YesGad NoGad' Request NoOK NoCancel GadgetStatus NoGad If Result = 1 Then LeaveBool = 0 End If LeaveBool = 1 Then Leave StartDefault = StartFrame EndDefault = EndFrame End /* Process StartFrame and EndFrame */ StartFrame = (StartFrame - 1) / 2 EndFrame = EndFrame / 2 Return StartFrame EndFrame GetFieldMode: Address 'OpalPaint_Rexx' ReqBuild '340 222 "Field Conversion Options"' AddBox '5 25 329 60' AddText 'CenterX 35 "Choose resolution of frames"' If PALBool = 0 Then AddGadget 'Cycle ResGad CenterX 55 90 20 736x476 640x400 368x236 320x200 160x100' If PALBool = 1 Then AddGadget 'Cycle ResGad CenterX 55 90 20 736x576 640x512 368x286 320x256 160x128' AddBox '5 155 329 34' AddGadget 'Check DeleteGad 30 162 Medium' AddText 'Right DeleteGad 5 6 "Delete original fields."' AddGadget 'Button OkayButton CenterX -5 Medium "Proceed"' InitGadget 'FullHeight 1' MutualEx 'FullHeight HalfHeight' Request NoOK NoCancel GadgetStatus ResGad DestPageX = Left(Result,3) DestPageY = Right(Result,3) GadgetStatus DeleteGad If Result = 1 Then DeleteBool = 1 Return DestPageX DestPageY DeleteBool GetIff: Address 'OpalPaint_Rexx' Iff = 'pic.000' || B If B < 10000 & B > 999 Then Iff = 'pic.' || B If B < 1000 & B > 99 Then Iff = 'pic.0' || B If B < 100 & B > 9 Then Iff = 'pic.00' || B Iff2 = 'pic.000' || (B + 1) If (B + 1) < 10000 & (B + 1) > 999 Then Iff2 = 'pic.' || (B + 1) If (B + 1) < 1000 & (B + 1) > 99 Then Iff2 = 'pic.0' || (B + 1) If (B + 1) < 100 & (B + 1) > 9 Then Iff2 = 'pic.00' || (B + 1) Iff3 = 'pic.000' || A If A < 10000 & A > 999 Then Iff3 = 'pic.' || A If A < 1000 & A > 99 Then Iff3 = 'pic.0' || A If A < 100 & A > 9 Then Iff3 = 'pic.00' || A Return Iff Iff2 Iff3 LookForFieldA: Address 'OpalPaint_Rexx' WaitCounter = 1 Do Forever If Open('render',AnimPathName || IFF,'r') = 1 Then Do Brad = Close('render') Menu DISABLE Address Command 'Copy ' || AnimPathName || IFF || ' Ram: Quiet' Leave End Else Do Address 'OpalPaint_Rexx' Menu ENABLE DisplayStatus 'Waiting ' || WaitCounter WaitCounter = WaitCounter + 1 Call Delay(3000) Address 'OpalPaint_Rexx' End End Return LoadFieldA: Address 'OpalPaint_Rexx' Loader Intelligent LoadComponents IMAGE Load 'Ram:' || IFF If Tokens ~= '' Then PageSize DestPageX DestPageY Tokens 0 If Tokens = '' Then PageSize DestPageX DestPageY 0 Address Command 'Delete ram:' || IFF || ' Quiet' Address 'OpalPaint_Rexx' Return LookForFieldB: Address 'OpalPaint_Rexx' WaitCounter = 1 Do Forever If Open('render',AnimPathName || IFF2,'r') = 1 Then Do Brad = Close('render') Menu DISABLE Address Command 'Copy ' || AnimPathName || IFF2 || ' Ram: Quiet' Leave End Else Do Menu ENABLE DisplayStatus 'Waiting ' || WaitCounter WaitCounter = WaitCounter + 1 Delay 3000 Address 'OpalPaint_Rexx' End End Return LoadFieldB: Address 'OpalPaint_Rexx' Loader Intelligent LoadComponents IMAGE Load 'Ram:' || IFF2 If Tokens ~= '' Then PageSize DestPageX DestPageY Tokens 0 If Tokens = '' Then PageSize DestPageX DestPageY 0 Address Command 'Delete ram:' || IFF2 || ' Quiet' Address 'OpalPaint_Rexx' Return GetTokens: Tokens = '' Tokens2 = '' If DestPageX = 736 Then Tokens = 'HIRES INTERLACE OVERSCAN' If DestPageX = 640 Then Tokens = 'HIRES INTERLACE' If DestPageX = 368 Then Tokens = 'OVERSCAN' Return Tokens Panic: /* Turn off all special functions */ Address 'OpalPaint_Rexx' Panic DeleteSten ExcludeAll DISABLE EnableColEntry 1 DISABLE EnableColEntry 2 DISABLE EnableColEntry 3 DISABLE EnableColEntry 4 DISABLE EnableColEntry 5 DISABLE EnableColEntry 6 DISABLE StenEnable = 0 Trans Disable SetDrawMode 1 ActiveNozzle 1 ResetATool Texture = 0 AntiAlias DISABLE Menu DISABLE Return AddSparePage: Address 'OpalPaint_Rexx' If Tokens ~= '' Then AddPage DestPageX DestPageY Tokens If Tokens = '' Then AddPage DestPageX DestPageY PickPage 2 Return GoToFirstPage: Address 'OpalPaint_Rexx' PickPage 1 SecondaryPage 2 Return LoadStencil: Address 'OpalPaint_Rexx' Loader Intelligent LoadComponents Stencil Load 'Images24:Stencils/FieldMachine.Sten' Refresh WorkMode IMAGE 'MaskSten Enable' 'StenEnable Enable' Return Rub: Address 'OpalPaint_Rexx' RubDirection 0 RubMode ABSOLUTE TextureType RUBTHROUGH 'Texture ENABLE' Zap Refresh DeleteSten Refresh DeletePage 2 Return SaveImage: Address 'OpalPaint_Rexx' Save 'Ram:' || Iff3 Address Command 'Copy Ram:' || IFF3 || ' ' || AnimPathName || 'Field Quiet' 'Delete Ram:' || IFF3 || ' Quiet' Address 'OpalPaint_Rexx' If DeleteBool = 1 Then Do Address Command 'Delete ' || AnimPathName || IFF || ' Quiet' 'Delete ' || AnimPathName || IFF2 || ' Quiet' Address 'OpalPaint_Rexx' End Return